package com.laojiang.mapper;

import com.laojiang.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {

    // 查询学生所有信息
    public List<Student> SelStudent(Student student);

    // 修改学生信息
    @Update("update student set student_name=#{student_name},student_sno=#{student_sno},student_age=#{student_age},student_data=#{student_data},student_phone=#{student_phone},\n" +
            "student_address=#{student_address},student_class=#{student_class} where student_sno=#{student_sno}\n")
    public int UpdataStudent(Student student);

    // 删除学生信息
    @Delete("DELETE  from student where 1=1 and student_sno=#{student_sno}")
    public int DelStudent(@Param("student_sno") String student_sno);

    // 添加学生信息
    @Insert("INSERT into student(student_name,student_sno,student_age,student_data,student_phone,student_address,student_class) \n" +
            "values(#{student_name},#{student_sno},#{student_age},#{student_data},#{student_phone},#{student_address},#{student_class})\n")
    public int AddStudent(Student student);

    // 分页显示学生信息
    public List<Student> SelStudentPage(@Param("student_sno") String student_sno,
                                        @Param("student_name") String student_name, @Param("student_class") String student_class,
                                        @Param("pageNo") int pageNo, @Param("pageSize") int pageSize);

}
